package com.yby6.common.exception;

import com.yby6.common.enums.ResultEnum;

/**
 * @program: yangbuyi-rbac
 * @ClassName: YangBuYiException
 * @create: 2021-05-14 13:47
 * @author: Yang Shuai
 * @since： JDK1.8
 * @YangBuYiException: 自定义异常$
 **/

public class YangBuYiException extends RuntimeException {

	private static final long serialVersionUID = 2450214686001409867L;

	private Integer errorCode = ResultEnum.ERROR.getCode();

	public YangBuYiException(ResultEnum resultEnum) {
		super(resultEnum.getMsg());
		this.errorCode = resultEnum.getCode();
	}

	public YangBuYiException(ResultEnum resultEnum, Throwable throwable) {
		super(resultEnum.getMsg(), throwable);
		this.errorCode = resultEnum.getCode();
	}

	public YangBuYiException(Integer errorCode, String msg) {
		super(msg);
		this.errorCode = errorCode;
	}

	public YangBuYiException(String msg) {
		super(msg);
	}

	public YangBuYiException(Throwable throwable) {
		super(throwable);
	}

	public YangBuYiException(String msg, Throwable throwable) {
		super(msg, throwable);
	}

	public Integer getErrorCode() {
		return errorCode;
	}

}
